Completed
Push — master ( e193d1...415e1b )
by Justin
01:32
created

AtomContent.js ➔ ... ➔ it(ꞌCreate with JSONꞌ)   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
rs 9.4285
1
var assert = require('chai').assert,
2
    GedcomX = require('../../');
3
4
describe('AtomContent', function(){
5
  
6
  it('Create plain', function(){
7
    assert.instanceOf(new GedcomX.AtomContent(), GedcomX.AtomContent, 'An instance of AtomContent is not returned when calling the constructor with new.');
8
    assert.instanceOf(GedcomX.AtomContent(), GedcomX.AtomContent, 'An instance of AtomContent is not returned when calling the constructor without new.');
9
  });
10
  
11
  it('Create with JSON', function(){
12
    var content = GedcomX.AtomContent({
13
      gedcomx: {
14
        description: '#root'
15
      }
16
    });
17
    assert.equal(content.getGedcomX().getDescription(), '#root');
18
  });
19
  
20
  it('Build', function(){
21
    var content = GedcomX.AtomContent()
22
      .setGedcomX(GedcomX().setDescription('#root'));
23
    assert.equal(content.getGedcomX().getDescription(), '#root');
24
  });
25
  
26
  it('toJSON', function(){
27
    var data = {
28
      gedcomx: {
29
        description: '#root'
30
      }
31
    }, content = GedcomX.AtomContent(data);
32
    assert.deepEqual(content.toJSON(), data);
33
  });
34
  
35
  it('constructor does not copy instances', function(){
36
    var obj1 = GedcomX.AtomContent();
37
    var obj2 = GedcomX.AtomContent(obj1);
38
    assert.strictEqual(obj1, obj2);
39
  });
40
  
41
});